package com.bolao.teamFragments;

import java.util.Locale;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.bolao.BuildingFragment;
import com.bolao.NewsFragment;
import com.bolao.R;
import com.entidades.Team;

public class TeamSectionsPagerAdapter extends FragmentPagerAdapter {

	private Context mContext;
	private Team mTeam;
	public TeamSectionsPagerAdapter(FragmentManager fm, Context context, Team team) {
		super(fm);
		mContext = context;
		mTeam = team;
	}

	@Override
	public Fragment getItem(int position) {
		switch (position){
		case 0: 
			return new TeamMatchsFragment(mTeam);
		case 1: 
			return new NewsFragment(mTeam);
		default: 
			return new BuildingFragment();
		}
	}

	@Override
	public int getCount() {
		// Show 3 total pages.
		return 3;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		Locale l = Locale.getDefault();
		switch (position) {
		case 0:
			return mContext.getResources().getString(R.string.teamsTabsMatches).toUpperCase(l);
		case 1:
			return mContext.getResources().getString(R.string.news).toUpperCase(l);
		case 2:
			return mContext.getResources().getString(R.string.videos).toUpperCase(l);
		}
		return null;
	}
}